home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / term / trms20d.lha / ScriptFiles.lha / dialer.scp next >
Text File  |  1993-09-24  |  1KB  |  66 lines

  1. /* $VER: Terminus 2.0 - dialer.scp (03.07.93) */
  2.  
  3. /*
  4. **    This is a simple script to manage dialing via scripts.
  5. ** It mimicks a subset of what the dialer is doing inside
  6. ** Terminus and is meant to show how to use WHEN commands, 
  7. ** but could be expanded for special purpose connection
  8. ** requirements.
  9. **
  10. ** Global variable usage:
  11. **
  12. ** Call with:
  13. **    
  14. **    d$ = phone number
  15. **    n$ = name
  16. **    i  = # of dialing attempts before exiting
  17. **    t  = dial attempt timeout value
  18. **    r  = redial delay timeout value
  19. **
  20. ** Used:
  21. **
  22. **    a$ = dial prefix
  23. **    p$ = dial postfix
  24. **    j  = counter
  25. **
  26. ** Exit:
  27. **
  28. **    k  = 1 for connection, 0 busy or exceeded dial attempts.
  29. **
  30. */
  31.  
  32. dial:
  33.    a$ = "atdt"
  34.    p$ = "^m"
  35.  
  36.    send "^m"
  37.    wait "OK"
  38.    cls
  39.    when all
  40.    when 1 "RING" goto ring
  41.    when 2 "BUSY" goto busy
  42.    when 3 "CONNECT" goto connect
  43.  
  44.    for j = 1 to i
  45.       print local "Dialing: "; n$; ", attempt - "; j
  46.       send a$
  47.       send d$
  48.       send p$
  49.       wait t
  50.       send p$
  51.       print local "Waiting..."
  52.       wait r
  53.    next
  54.    /* fall thru */
  55.  
  56. busy:
  57.    k = 0
  58.    goto end_dial
  59.  
  60. connect:
  61.    k = 1
  62.    /* fall thru */
  63.  
  64. end_dial:
  65.    end
  66.